package com.demo.fulllink.common.emum;

import com.demo.fulllink.module.vo.ResponseVO;

public enum ResponseErrorEnum {
    STOCK_ERROR(ResponseVO.ResponseState.ERROR, 1, "库存不足"),
    ORDER_ERROR(ResponseVO.ResponseState.ERROR, 2, "订单不存在"),
    REPEAT_REQUEST_ERROR(ResponseVO.ResponseState.ERROR, 3, "重复请求"),
    PRODUCT_NOT_EXIST_ERROR(ResponseVO.ResponseState.ERROR, 1, "产品不存在"),
    ACCOUNT_NOT_EXIST_ERROR(ResponseVO.ResponseState.ERROR, 1, "账户不存在");
    
    ResponseErrorEnum(ResponseVO.ResponseState state, int errorCode, String errorMsg) {
        this.state = state;
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
    
    private ResponseVO.ResponseState state;
    private int errorCode;
    private String errorMsg;
    
    public ResponseVO.ResponseState getState() {
        return state;
    }
    
    public void setState(ResponseVO.ResponseState state) {
        this.state = state;
    }
    
    public int getErrorCode() {
        return errorCode;
    }
    
    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
    
    public String getErrorMsg() {
        return errorMsg;
    }
    
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
    
    public ResponseVO toResponseVO() {
        ResponseVO responseVO = new ResponseVO();
        responseVO.setState(getState());
        responseVO.setErrorCode(getErrorCode());
        responseVO.setErrorMsg(getErrorMsg());
        return responseVO;
    }
}
